<?php

namespace app\api\controller\v2;

use think\facade\Log;
use think\Request;

class Wechat
{
    /*
     * 微信授权成功之后，重定向到前端地址
     */
    public function authRedirect(Request $request)
    {


        $url = input('url');
        $code = input('code');

        Log::info('跳转时获取到的url：'.$url);

        if (empty($url)) {
            echo '缺少参数 url';
            exit;
        }
        if ($code){
            $url = urlParamReplace($url, 'code', $code);
        }

        if (strstr($url,'ymhcccc')){
            $url = str_replace('ymhcccc','#',$url);//有美惠充冲冲冲
        }


        header('Location: ' . $url);
    }
}
